import QRequest from '@/service/index';
import { WorkingCalendarParams, WorkingCalendarResponse } from './model/type';
import { generateNameToLevel } from '@/config/constant';

/**
 * @description: 工作日历
 * @param {WorkingCalendarParams} params
 * @return {*}
 */
export const doGetWorkingPeriodList = (params?: WorkingCalendarParams) => {
    return QRequest.get<WorkingCalendarResponse>(`/workingCalendar`, {
        params,
        headers: {
            loadingTarget: `#${generateNameToLevel('1')}`
        }
    });
};

/**
 * @description: 更改工作日历
 * @param {WorkingCalendarParams} params
 * @return {*}
 */
export const doUpdateWorkingPeriodList = (data: { id: number; periodId: number }) => {
    return QRequest.put(`/workingCalendar/update`, data, {
        headers: {
            hideLoading: 1
        }
    });
};
